package com.ms.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.redis.core.RedisHash;

import java.time.LocalDateTime;

@Data
@Builder
@RedisHash(timeToLive = 180 * 24 * 3600) // 消息保存180天
public class Message {
    @Id
    private Long id; // Redis生成的ID

    // 接收消息的用户ID
    private Integer userId;
    private String title;
    private String content;
    private String type;
    private Boolean isRead;
    // 关联的资源ID
    private Integer relatedId;
    private Long createTime; // 使用时间戳存储
}
